package com.swak.persistence.mybatis.methods.impls;

import com.swak.persistence.mybatis.methods.AbstractMethod;
import com.swak.persistence.mybatis.methods.Sqls;

/**
 * 条件查询
 * 
 * @author lifeng
 * @date 2021年1月25日 下午5:13:45
 */
public class ExistsByCondition extends AbstractMethod {

	@Override
	protected void doInject() {
		if (!this.supportMethod(Sqls.EXISTS_BY_CONDITION)) {
			return;
		}
		String sql = new StringBuilder().append(SCRIPT_START).append(EXISTS).append(SPACE).append(this.table.getName())
				.append(SPACE).append(this.parseWhereLogicDelEqualColumn(false))
				.append(ExistsByCondition.includeConditionClause()).append(RIGHT_BRACKET).append(SCRIPT_END).toString();

		this.addSelectMappedStatementForOther(Sqls.EXISTS_BY_CONDITION.getMethod(), sql, Integer.class);
	}

}
